import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'utils/app_logger.dart';
import 'utils/theme_provider.dart';
import 'screen/splash_screen.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // 初始化日志系统
  await AppLogger().init();
  // 获取日志单例
  final logger = AppLogger();
  logger.info('应用启动');

  runApp(ChangeNotifierProvider(
    create: (context) => ThemeProvider(),
    child: const MyApp(),
  ),);
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {

    return Consumer<ThemeProvider>(
      builder: (context, themeProvider, child) {
        return MaterialApp(
          title: 'Flutter APP Demo 示例',
          theme: themeProvider.theme,
          home: SplashScreen(),
          // 设置取消debug旗帜
          debugShowCheckedModeBanner: false,
        );
      },
    );

  }

}
